calculate v and x in the circuit